<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <title>Title</title>
</head>
<script type="text/css">
    span{ color:red}
</script>
<body>

<table>
    <tr>
        <th>addressId</th>
        <th>provinceCode</th>
        <th>cityCode</th>
    </tr>
    <tr th:each="data : ${data.list}">
        <td th:text="${data.addressId}" align="center"/>
        <td th:text="${data.provinceCode}" align="center"/>
        <td th:text="${data.cityCode}" align="center"/>
    </tr>
</table>
<div id="barcon" name="barcon" ></div>  <select id="test_select" >
    <option value="10">10</option>
    <option value="50">50</option>
    <option value="100">100</option>
</select>
<script>
    var pagesize=[[${data.size}]];
    if(pagesize==10)
        document.getElementById("test_select")[0].selected=true
    if(pagesize==50)
        document.getElementById("test_select")[1].selected=true
    if(pagesize==100)
        document.getElementById("test_select")[2].selected=true
    var page = [[${data.pageNum}]]
    var show=3
    var total= [[${data.pages}]]
    var str = '<span class="indexpage" style="color:red">'+page + '</span>';
    for (var i = 1; i <= show; i++) {
        if (page - i > 1) {
            var numer=page - i
            str = "<a    onclick='hrefclick(numer)'><span>"+ numer +"</span></a>" + ' ' + str;
        }
        if (page + i < total) {
            var numer=page + i
            str = str + ' ' + "<a    onclick='hrefclick(numer)'><span>"+ numer +"</span></a>";
        }
    }
    if (page - (show + 1) > 1) {
        str = '... ' + str;
    }
    if (page > 1) {
        str = "<span onclick='hrefclick(1)'>"+ 1 +"</span>" + ' ' + str;
    }
    if (page + show + 1 < total) {
        str = str + ' ...';
    }
    if (page < total) {
        str = str + ' ' + "<a    onclick='hrefclick(total)'><span>"+ total +"</span></a>";
    }
    document.getElementById("barcon").innerHTML = str;
    function hrefclick(page){
        window.location.replace("?pagenum="+page+"&pagesize="+document.getElementById("test_select").value)
    }
</script>
</body>
</html>